#pragma once

#include <osg\NodeCallback>
#include "vrdatacore_global.h"
#include "lightactorbase.h"

namespace VrDataCore
{
	class LightUpdateCallback;

	class VRDATACORE_EXPORT EyePositionLightSource:public LightActorBase
	{
	public:
		EyePositionLightSource();
		void update();
		virtual void buildPropertyMap();
		virtual void setActive(CoreBase::Viewer* viewer,CoreBase::Scene* scene);
		virtual void setUnactive();
	protected:
		~EyePositionLightSource();
		osg::ref_ptr<LightUpdateCallback>						_updateCallback;
	};

	class LightUpdateCallback : public osg::NodeCallback
	{
	public:
		LightUpdateCallback(EyePositionLightSource* dls)
		{
			_dls = dls;
		}
		~LightUpdateCallback(){} ;
		virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
		{
			if( !_dls )
				return ;
			_dls->update();
		}
	protected:
		EyePositionLightSource*							_dls ;
	};
}